package cn.com.action;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.com.biz.UserBiz;
import cn.com.entity.User;

import com.opensymphony.xwork2.ActionSupport;

public class ZhuCeAction extends ActionSupport implements SessionAware {
	private Map<String,Object> session;
	private User u;
	
	public User getU() {
		return u;
	}

	public void setU(User u) {
		this.u = u;
	}
	@Override
	public void setSession(Map<String, Object> arg0) {
		// TODO Auto-generated method stub
		session=arg0;
	}

private UserBiz userBiz;
	
	public UserBiz getUserBiz() {
		return userBiz;
	}

	public void setUserBiz(UserBiz userBiz) {
		this.userBiz = userBiz;
	}
	public void validate(){
		
	}

	public String execute(){
		ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
		userBiz=(UserBiz)ctx.getBean("userBiz");
		User user=userBiz.zhuce(u);
		if(user!=null){
			return SUCCESS;
		}else{
			return LOGIN;
		}
	}
}
